package com.hcrazy.manchester.app.services;

import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;

public class GoogleAPI {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String googleAPIKey = "AIzaSyA88Qn1Lo7HDiZwaqEqE9H8M8nsZk45YyE";
		String language = "zh-CN";
		int radius = 500;
		boolean sensor = false;
		String location = "39.910093,116.403945";
		
		//String uri = "https://maps.googleapis.com/maps/api/place/search/json?location=39.910093,116.403945&radius="+radius+"&sensor="+false+"&key="+googleAPIKey+"&language="+language;
		//String uri = "https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=AIzaSyA88Qn1Lo7HDiZwaqEqE9H8M8nsZk45YyE&language="+language;
		
		String uri = "https://maps.googleapis.com/maps/api/place/details/json?reference=" +
				"CoQBdQAAAApNWa6HezCPqoKOVTb3KTTeMXusI3DAfqg1ZXR6KNu6mQhGprGYL654EYImASIylTz3PLu1utkEIMK7zkix0HXTfXfG3D5ryV6VcsKG8fSYmHUjo3_TWDPLes2EVPUG6pSSLGtxsvWnaJzEMHkAywqQb9OI6iC0KNWWqP6Cjl6DEhAKgeVsaqXBZYXyTX1eoafiGhSGKGpn8v0GoCj4uCvkwScDqnd-fA" +
				"&sensor=true&key=AIzaSyA88Qn1Lo7HDiZwaqEqE9H8M8nsZk45YyE&language=zh-CN";
		
		HttpClient httpClient = new HttpClient();
		GetMethod method = new GetMethod(uri);
		
		try {
			httpClient.executeMethod(method);
			String result = method.getResponseBodyAsString();
			System.out.println(result);
		} catch (HttpException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
